from turtle import *


my_turtle = Turtle()
my_win = my_turtle.getscreen()


def tree(my_turtle, branch_len):
    if branch_len > 5:
        my_turtle.forward(branch_len)
        my_turtle.right(20)
        tree(my_turtle, branch_len-15)
        my_turtle.left(40)
        tree(my_turtle, branch_len - 10)
        my_turtle.right(20)
        my_turtle.backward(branch_len)


my_turtle.left(90)
my_turtle.up()
my_turtle.backward(300)
my_turtle.down()
my_turtle.color('green')
tree(my_turtle, 100)
my_win.exitonclick()